scrolledwindow: deprecate scrollbars-within-bevel style property
authorCosimo Cecchi <cosimoc@gnome.org>
Wed, 23 Dec 2015 04:45:33 +0000 (20:45 -0800)
committerCosimo Cecchi <cosimoc@gnome.org>
Tue, 29 Dec 2015 21:51:06 +0000 (13:51 -0800)
These days all the themes set it to TRUE, and it's not clear what
happens with overlay scrollbars...

gtk/gtkscrolledwindow.c
gtk/theme/Adwaita/_common.scss
gtk/theme/Adwaita/gtk-contained-dark.css
gtk/theme/Adwaita/gtk-contained.css
gtk/theme/HighContrast/_common.scss
gtk/theme/HighContrast/gtk.css
gtk/theme/win32/gtk-win32-base.css

index 5eaaf7f2e2d70f8157033ff92eb0f4bc38fefd8e..950ad3d3adeef5f837f722346c8f2cf65b53ae85 100644 (file)
@@ -601,6 +601,8 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
    * Whether to place scrollbars within the scrolled window's bevel.
    *
    * Since: 2.12
+   *
+   * Deprecated: 3.20: the value of this style property is ignored.
    */
   gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_boolean ("scrollbars-within-bevel",
@@ -2203,19 +2205,15 @@ gtk_scrolled_window_draw_scrollbars_junction (GtkScrolledWindow *scrolled_window
   GtkAllocation hscr_allocation, vscr_allocation;
   GtkStyleContext *context;
   GdkRectangle junction_rect;
-  gboolean is_rtl, scrollbars_within_bevel;
+  gboolean is_rtl;
 
   is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
   gtk_widget_get_allocation (GTK_WIDGET (priv->hscrollbar), &hscr_allocation);
   gtk_widget_get_allocation (GTK_WIDGET (priv->vscrollbar), &vscr_allocation);
 
-  gtk_widget_style_get (widget,
-                        "scrollbars-within-bevel", &scrollbars_within_bevel,
-                        NULL);
   context = gtk_widget_get_style_context (widget);
 
-  if (scrollbars_within_bevel &&
-      priv->shadow_type != GTK_SHADOW_NONE)
+  if (priv->shadow_type != GTK_SHADOW_NONE)
     {
       GtkStateFlags state;
       GtkBorder padding, border;
@@ -2384,53 +2382,24 @@ gtk_scrolled_window_draw (GtkWidget *widget,
 {
   GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
   GtkScrolledWindowPrivate *priv = scrolled_window->priv;
-  GtkAllocation relative_allocation;
   GtkStyleContext *context;
-  gboolean scrollbars_within_bevel;
 
   if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
     {
       context = gtk_widget_get_style_context (widget);
-      gtk_scrolled_window_relative_allocation (widget, &relative_allocation);
 
       gtk_render_background (context, cr,
                              0, 0,
                              gtk_widget_get_allocated_width (widget),
                              gtk_widget_get_allocated_height (widget));
+      gtk_render_frame (context, cr,
+                        0, 0,
+                        gtk_widget_get_allocated_width (widget),
+                        gtk_widget_get_allocated_height (widget));
 
       if (priv->hscrollbar_visible &&
           priv->vscrollbar_visible)
         gtk_scrolled_window_draw_scrollbars_junction (scrolled_window, cr);
-
-      gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
-
-      if (!scrollbars_within_bevel)
-        {
-          GtkStateFlags state;
-          GtkBorder padding, border;
-
-          state = gtk_style_context_get_state (context);
-          gtk_style_context_get_padding (context, state, &padding);
-          gtk_style_context_get_border (context, state, &border);
-
-          relative_allocation.x -= padding.left + border.left;
-          relative_allocation.y -= padding.top + border.top;
-          relative_allocation.width += padding.left + padding.right + border.left + border.right;
-          relative_allocation.height += padding.top + padding.bottom + border.top + border.bottom;
-        }
-      else
-        {
-          relative_allocation.x = 0;
-          relative_allocation.y = 0;
-          relative_allocation.width = gtk_widget_get_allocated_width (widget);
-          relative_allocation.height = gtk_widget_get_allocated_height (widget);
-        }
-
-      gtk_render_frame (context, cr,
-                        relative_allocation.x,
-                        relative_allocation.y,
-                        relative_allocation.width,
-                        relative_allocation.height);
     }
 
   GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->draw (widget, cr);
@@ -2745,11 +2714,7 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
   GtkAllocation child_allocation, content_allocation;
   GtkWidget *widget = GTK_WIDGET (scrolled_window);
   gint sb_spacing, sb_height, sb_width;
-  gboolean scrollbars_within_bevel;
   GtkScrolledWindowPrivate *priv;
-  GtkBorder padding, border;
-  GtkStyleContext *context;
-  GtkStateFlags state;
 
   priv = scrolled_window->priv;
 
@@ -2758,13 +2723,6 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
   gtk_widget_get_preferred_height (priv->hscrollbar, &sb_height, NULL);
   gtk_widget_get_preferred_width (priv->vscrollbar, &sb_width, NULL);
 
-  context = gtk_widget_get_style_context (widget);
-  state = gtk_style_context_get_state (context);
-
-  gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
-  gtk_style_context_get_padding (context, state, &padding);
-  gtk_style_context_get_border (context, state, &border);
-
   if (scrollbar == priv->hscrollbar)
     {
       child_allocation.x = content_allocation.x;
@@ -2787,21 +2745,6 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
 
       child_allocation.width = content_allocation.width;
       child_allocation.height = sb_height;
-
-      if (priv->shadow_type != GTK_SHADOW_NONE)
-       {
-          if (!scrollbars_within_bevel)
-            {
-              child_allocation.x -= padding.left + border.left;
-              child_allocation.width += padding.left + padding.right + border.left + border.right;
-
-              if (priv->window_placement == GTK_CORNER_TOP_LEFT ||
-                  priv->window_placement == GTK_CORNER_TOP_RIGHT)
-                child_allocation.y += padding.bottom + border.bottom;
-              else
-                child_allocation.y -= padding.top + border.top;
-            }
-       }
     }
   else if (scrollbar == priv->vscrollbar)
     {
@@ -2828,25 +2771,6 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
       child_allocation.y = content_allocation.y;
       child_allocation.width = sb_width;
       child_allocation.height = content_allocation.height;
-
-      if (priv->shadow_type != GTK_SHADOW_NONE)
-       {
-          if (!scrollbars_within_bevel)
-            {
-              child_allocation.y -= padding.top + border.top;
-             child_allocation.height += padding.top + padding.bottom + border.top + border.bottom;
-
-              if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL &&
-                   (priv->window_placement == GTK_CORNER_TOP_RIGHT ||
-                    priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
-                  (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR &&
-                   (priv->window_placement == GTK_CORNER_TOP_LEFT ||
-                    priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
-                child_allocation.x += padding.right + border.right;
-              else
-                child_allocation.x -= padding.left + border.left;
-            }
-        }
     }
 
   *allocation = child_allocation;
index 25e0d8dee97374e515791742b32c0c6086142373..1f94ced3c62dbb211e8049c289f96fbb9bdf778f 100644 (file)
@@ -16,7 +16,6 @@ $asset_suffix: if($variant=='dark', '-dark', '');
   // only in the width
 
   -GtkScrolledWindow-scrollbar-spacing: 0;
-  -GtkScrolledWindow-scrollbars-within-bevel: 1;
 
   -GtkToolItemGroup-expander-size: 11;
   -GtkTreeView-expander-size: 11;
index d209054d57da33431fe477046c5972de3bd6af9d..c54514649f73d05099a44736bf18a6f7ad0ccce6 100644 (file)
@@ -3,7 +3,6 @@
   -GtkToolButton-icon-spacing: 4;
   -GtkTextView-error-underline-color: #cc0000;
   -GtkScrolledWindow-scrollbar-spacing: 0;
-  -GtkScrolledWindow-scrollbars-within-bevel: 1;
   -GtkToolItemGroup-expander-size: 11;
   -GtkTreeView-expander-size: 11;
   -GtkTreeView-horizontal-separator: 4;
index d5df390ce58782780b3bda961743209aa51a41a5..60cfc2dfbb31f40545ebc9e08c190fd42fd58da6 100644 (file)
@@ -3,7 +3,6 @@
   -GtkToolButton-icon-spacing: 4;
   -GtkTextView-error-underline-color: #cc0000;
   -GtkScrolledWindow-scrollbar-spacing: 0;
-  -GtkScrolledWindow-scrollbars-within-bevel: 1;
   -GtkToolItemGroup-expander-size: 11;
   -GtkTreeView-expander-size: 11;
   -GtkTreeView-horizontal-separator: 4;
index 257fd8286422657d1966af7e7db3d06a9bc85ab1..4dc5ce6db990e738a878155396ca94f7de16e093 100644 (file)
@@ -20,7 +20,6 @@ $ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
   // only in the width
 
   -GtkScrolledWindow-scrollbar-spacing: 0;
-  -GtkScrolledWindow-scrollbars-within-bevel: 1;
 
   -GtkToolItemGroup-expander-size: 11;
   -GtkExpander-expander-size: 16;
index 3b6ef36932373a3b3f170369f214d38b71f8e5a6..db3a1cb38b6390fab9e83d4d68ce9f34d7567e1b 100644 (file)
@@ -40,7 +40,6 @@
   -GtkCheckButton-indicator-size: 16;
   -GtkCheckMenuItem-indicator-size: 16;
   -GtkScrolledWindow-scrollbar-spacing: 0;
-  -GtkScrolledWindow-scrollbars-within-bevel: 1;
   -GtkToolItemGroup-expander-size: 11;
   -GtkExpander-expander-size: 16;
   -GtkTreeView-horizontal-separator: 4;
index cac37877f11f79d9345973773725a7bd99cba915..350d6a1b06168c2e3b9da7f67fc2936da25be5e9 100644 (file)
@@ -31,7 +31,6 @@ GtkViewport {
     -GtkWidget-visited-link-color: -gtk-win32-color(button, 26);
     border-color: shade (@bg_color, 0.6);
 
-    -GtkScrolledWindow-scrollbars-within-bevel: 1;
     -GtkScrolledWindow-scrollbars-spacing: 0;
 }